<?php


namespace App\Repositories;


use LTools\Repositories\RepositoryAbstract;

class HsCode extends RepositoryAbstract
{
    /**
     * HsCode constructor.
     * @param \App\Models\HsCode $model
     * @author luffyzhao@vip.126.com
     */
    public function __construct(\App\Models\HsCode $model)
    {
        $this->model = $model;
    }

    /**
     * @param array $attributes
     * @return bool|\Illuminate\Database\Eloquent\Model
     * @author luffyzhao@vip.126.com
     */
    public function create(array $attributes = [])
    {
        $attributes['unit2'] = $attributes['unit2'] ?? '';
        return parent::create($attributes);
    }

    /**
     * @param $id
     * @param array $values
     * @return bool|\Illuminate\Database\Eloquent\Model
     * @throws \Throwable
     * @author luffyzhao@vip.126.com
     */
    public function update($id, array $values)
    {
        $values['unit2'] = $values['unit2'] ?? '';
        return parent::update($id, $values);
    }
}